<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>一隅立画</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="./css/element.css"/>
		<link rel="stylesheet" type="text/css" href="./layui/css/layui.css" />
		<link rel="stylesheet" type="text/css" href="./css/fabu.css" />
		<link rel="stylesheet" type="text/css" href="./css/basestyle.css" />
		<script src="js/head.js" type="text/javascript"></script>
		<script src="js/xshead.js" type="text/javascript"></script>
		<script src="js/base.js"></script>
	</head>
	<body>
		<!-- 主体部分 -->
		<div class="content">
			<div class="container">
				<div class="row">
					<div id="paychoice" class="col-lg-8 col-md-8">
						<div ref="popupjiazai" style="display: none;">
							<div class="releaseone">
								<div class="releaseonetitle">
									<div class="releaseonetitletxt">
										<p class="othertitle" v-show="languagestatus == 1">请填写竞赛标题</p>
										<p class="othertitle" v-show="languagestatus == 2">Please fill in the title of the competition</p>
									</div>
									<div class="releaseonetitleipt">
										<input v-model="fabutitle" type="text"   />
									</div>
								</div>
								<div class="releaseonetitle">
									<div class="releaseonetitletxt">
										<p class="othertitle" v-show="languagestatus == 1">请填写搜索竞赛关键词</p>
										<p class="othertitle" v-show="languagestatus == 2">Please fill in the search contest keywords<span></span></p>
									</div>
									<div class="releaseonetitleipt">
										<input v-model="fabukeyword" type="text"   />

									</div>
								</div>
								<div class="releaseonetitle">
									<div class="releaseonetitletxt">
										<p class="othertitle" v-show="languagestatus == 1">请上传竞赛封面图<span style="color: #FF0000;font-weight: 600;">（可选择）</span></p>
										<p class="othertitle" v-show="languagestatus == 2">Please upload the cover picture of the competition</p>
									</div>
									<div class="releaseonetitleipt">
										<div class="iptbtn">
											<img :src="showWorks">
											<input class="upImg" type="file" @change="add_img" />
										</div>
									</div>

								</div>
							</div>
							<div class="releasetwo">
								<div class="releasetwodata">
									<div class="releaseonetitletxt">
										<p class="othertitle" v-show="languagestatus == 1">请填写竞赛截止时间<span style="color: #FF0000;font-weight: 600;">（注：截止后请在72小时内确定获奖作品，超时将由后台随机评定）</span></p>
										<p class="othertitle" v-show="languagestatus == 2">Please fill in the deadline of the competition</p>
									</div>
									<div class="releasetwodataipt" v-show="languagestatus == 1">
										<el-date-picker v-model="value2" type="datetime" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" placeholder="选择日期时间" align="right"></el-date-picker>
									</div>
									<div class="releasetwodataipt" v-show="languagestatus == 2">
										<el-date-picker v-model="value2" type="datetime" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" placeholder="Select date time" align="right"></el-date-picker>
									</div>
								</div>
								<div class="releasetwodata releasetwomore">
									<div class="releasetwodatatxt">
										<p class="othertitle" v-show="languagestatus == 1">请填写竞赛描述</p>
										<p class="othertitle" v-show="languagestatus == 2">Please fill in the competition description</p>
									</div>
									<div class="releasetwodataipt">
										<textarea name="content" lay-verify="content" id="textedit" class="releasetwodatatxtmore" rows="4" cols=""></textarea>
									</div>
								</div>
							</div>
							<div class="releasethree">
								<div class="releasethreetitle">
									<p v-show="languagestatus == 1">请选择竞赛金额<span>（获奖人数及奖项比例将自动限定）</span></p>
									<p v-show="languagestatus == 2">Please fill in the competition description<span></span></p>
								</div>
								<div class="releasethreetype">
									<div class="releasethreetypeone" v-for="(type,index) in racetypelist" :key='index'>
										<div class="releasethreetypeonenav">
											<input type="number" v-model="type.number" min="0" @focus="changemoned(index)" @blur="blurClick(index,type.id)" />
											<div class="releasethreetypeoneline"></div>
											<div class="releasethreetypeonenavrange">
												<p v-if="index != indexk">(￥{{type.minmoney}} - {{type.maxmoney}})</p>
												<p v-else>(￥{{type.minmoney}}+)</p>
											</div>
											<div class="releasethreetypeonenavexplain">
												<p v-show="languagestatus == 1">{{type.name}}</p>
												<p v-show="languagestatus == 2">{{type.nameE}}</p>
												<p v-show="languagestatus == 1">参选作品>{{type.minnumber}}件</p>
												<p v-show="languagestatus == 2">Candidate works>{{type.minnumber}}</p>
											</div>
										</div>
										<div class="releasethreetypeonetip" v-show="languagestatus == 1">
											<p>*{{type.describe}}</p>
											<p>{{type.proportion}}</p>
										</div>
										<div class="releasethreetypeonetip" v-show="languagestatus == 2">
											<p>*{{type.describeE}}</p>
											<p>{{type.proportionE}}</p>
										</div>
									</div>
								</div>
								<div class="releasethreead">
									<div class="releasethreeadbanner" v-show="adslist.homestatus != 0">
										<div class="releasethreeadbannertxt" v-show="languagestatus == 1">
											<p class="releasethreeadbannertxttitle">首页广告位展示（{{adslist.adsdays}}天）</p>
											<p class="releasethreeadbannertxttip">¥{{adslist.homemoney}} <span v-show="adslist.homestatus == 1">（最近的广告位在{{adslist.hometime}}空余）</span></p>
										</div>
										<div class="releasethreeadbannertxt" v-show="languagestatus == 2">
											<p class="releasethreeadbannertxttitle">Display of advertising space on home page（{{adslist.adsdays}}days）</p>
											<p class="releasethreeadbannertxttip">¥{{adslist.homemoney}} <span v-show="adslist.homestatus == 1">（Where is the nearest advertising space{{adslist.hometime}}free）</span></p>
										</div>
										<div class="releasethreeadbannernum">
											<div class="releasethreeadbannernumitem" @click="reduceindex">
												<p>-</p>
											</div>
											<div class="releasethreeadbannernumitem">
												<p>{{indexbannernum}}</p>
											</div>
											<div class="releasethreeadbannernumitem" @click="plusindex">
												<p>+</p>
											</div>
										</div>
									</div>
									<div class="releasethreeadbanner" v-show="adslist.sidetatus != 0">
										<div class="releasethreeadbannertxt" v-show="languagestatus == 1">
											<p class="releasethreeadbannertxttitle">侧边栏广告位展示（{{adslist.adsdays}}天）</p>
											<p class="releasethreeadbannertxttip">¥{{adslist.sidemoney}} <span v-show="adslist.sidetatus == 1">（最近的广告位在{{adslist.sidetime}}空余）</span></p>
										</div>
										<div class="releasethreeadbannertxt" v-show="languagestatus == 2">
											<p class="releasethreeadbannertxttitle">Sidebar advertising space display（{{adslist.adsdays}}days）</p>
											<p class="releasethreeadbannertxttip">¥{{adslist.sidemoney}} <span v-show="adslist.sidetatus == 1">（Where is the nearest advertising space {{adslist.sidetime}}free）</span></p>
										</div>
										<div class="releasethreeadbannernum">
											<div class="releasethreeadbannernumitem" @click="reduceside">
												<p>-</p>
											</div>
											<div class="releasethreeadbannernumitem">
												<p>{{sideadnum}}</p>
											</div>
											<div class="releasethreeadbannernumitem" @click="plusside">
												<p>+</p>
											</div>
										</div>
									</div>
									<div class="releasethreeadbanner" v-show="adslist.sidetatus != 0 || adslist.homestatus != 0">
										<p v-show="languagestatus == 1" class="releasethreeadbannertxttitle">(提示：{{adslist.tips}})</p>
										<p v-show="languagestatus == 2" class="releasethreeadbannertxttitle">(Tips：{{adslist.tipsE}})</p>
									</div>
								</div>
								<div class="releasethreepay" v-if="totalmoney != ''? true:false">
									<p v-show="languagestatus == 1">总计需支付：</p>
									<p v-show="languagestatus == 2">Total to be paid：</p>
									<span>￥</span>
									<span>{{totalmoney}}</span>
								</div>
								<div class="clear"></div>
								<div class="releasethreexuzhi">
									<div class="releasethreexuzhicheckbox" @click="agreeicon">
										<img v-show="choiceicon == 0" src="./images/checkbox_icon.png">
										<img v-show="choiceicon == 1" src="./images/checked_icon.png">
									</div>
									<div class="releasethreexuzhitip" v-show="languagestatus == 1">
										<p>我已同意</p>
										<span>《用户协议》</span>
									</div>
									<div class="releasethreexuzhitip" v-show="languagestatus == 2">
										<p>I have agreed</p>
										<span>《User agreement》</span>
									</div>
								</div>
								<div class="releasethreebtn">
									<div class="releasethreebtnf releasethreebtnitem" @click="openchoice">
										<p v-show="languagestatus == 1">发布</p>
										<p v-show="languagestatus == 2">release</p>
									</div>
								</div>
							</div>
							<div >
								<!-- 勾选 -->
								<div class="judgepopup" v-show="tanchuang1 == 1">
									<div class="judgepopupnav">
										<div class="judgepopupwarp">
											<div class="judgepopupwarpup">
												<img src="./images/revoke_logo.png">
											</div>
											<div class="judgepopupwarpdown">
												<div class="judgepopupwarptxt">
													<p v-show="languagestatus == 1">请勾选用户协议或选择竞赛金额</p>
													<p v-show="languagestatus == 2">Please check the user agreement or select the contest amount</p>
												</div>
												<div class="judgepopupwarpbtn">
													<!-- <div class="judgepopupwarpbtnitem" @click="">
													<p>取消</p>
												</div> -->
													<div class="judgepopupwarpbtnitem judgepopupwarpbtnactive" @click="closeagreement">
														<p v-show="languagestatus == 1">确认</p>
														<p v-show="languagestatus == 2">confirm</p>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
								<!-- 用户协议内容 -->
								<!-- <div class="judgepopup" v-show="agreementtip == 1">
									<div class="judgepopupnav">
										<div class="agreementtipwarp">
											<div class="judgepopupwarpup">
												<img src="./images/revoke_logo.png">
											</div>
											<div class="agreementtitle">
												<p>用户协议</p>
											</div>
											<div class="judgepopupwarpdown">
												<div class="agreementcontent">
													<p v-show="languagestatus == 1" v-html="usercontent"></p>
													<p v-show="languagestatus == 2" v-html="userEcontent"></p>
												</div>
												<div class="judgepopupwarpbtn">
													<div class="judgepopupwarpbtnitem judgepopupwarpbtnactive" @click="closeagreementtip">
														<p v-show="languagestatus == 1">同意</p>
														<p v-show="languagestatus == 2">agree</p>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div> -->
								<!-- 支付弹窗 -->
								<div class="pay" v-show="choice == 1 && moveshow == 0">
									<div class="paynav">
										<div class="paywarp">
											<div class="paywarpimg">
												<img src="./images/pay_icon.png">
											</div>
											<div v-show="fabuerr == 0">
												<div class="paycontent">
													<div class="paycontenttitle">
														<p v-show="languagestatus == 1">请支付本次发布的费用</p>
														<p v-show="languagestatus == 2">Please pay for this release</p>
													</div>
													<div class="paycontentcost">
														<p class="zhifu"  v-show="languagestatus == 1">扫码支付:</p>
														<p class="zhifu"  v-show="languagestatus == 2">Payment by scanning code:</p>
														<p class="qainlogo" v-if="totalmoney != '' ?true:false">¥</p>
														<span>{{totalmoney}}</span>
													</div>
													<div class="paycontentmode">
														<div class="paycontentmodeitem paycontentmodewx " @click.stop="changPaychoice(1)" :class="{'paycontentmodeactive' :changfabuPaychoice == 1}">
															<p v-show="languagestatus == 1">微信</p>
															<p v-show="languagestatus == 2">WeChat</p>
														</div>
														<div class="paycontentmodeitem" @click.stop="changPaychoice(2)" :class="{'paycontentmodeactive' :changfabuPaychoice == 2}">
															<p v-show="languagestatus == 1">支付宝</p>
															<p v-show="languagestatus == 2">Alipay</p>
														</div>
													</div>
													<div class="paycontentcode" v-show="changfabuPaychoice == 1">
														<div class="paycontentcodeimg">
															<img v-show="wechatpaystastus == 1" :src="wechatpayimg">
															<img id="paysuccess" v-show="wechatpaystastus == 0" src="./images/paysuccess.png" >
														</div>
														<div class="paycontentcodetxt"  v-show="languagestatus == 1">
															<p v-show="wechatpaystastus == 1">扫描二维码</p>
															<p v-show="wechatpaystastus == 0">支付成功</p>
														</div>
														<div class="paycontentcodetxt"  v-show="languagestatus == 2">
															<p v-show="wechatpaystastus == 1">Scan QR code</p>
															<p v-show="wechatpaystastus == 0">Payment successful</p>
														</div>
													</div>
													<div class="paycontentcode" v-show="changfabuPaychoice == 2">
														<div class="paycontentcodeimg">
															<p>即将跳转支付宝链接支付...</p>
														</div>
													</div>
													<div class="paycontentbtn">
														<div v-show="wechatpaystastus != 0" class="paycontentbtnitem" @click="fabuconsolePay">
															<p v-show="languagestatus == 1">取消</p>
															<p v-show="languagestatus == 2">cancel</p>
														</div>
														<div v-show="wechatpaystastus == 0" class="paycontentbtnitem paycontentbtncomfire" @click="comfirefabu">
															<p v-show="languagestatus == 1">确定</p>
															<p v-show="languagestatus == 2">determine</p>
														</div>
													</div>
												</div>
											</div>
											<div class="errotype" v-show="fabuerr == 1">
												<div class="errotypeimg">
													<img src="./images/error.png" >
												</div>
												<p>发布错误，请稍后再试</p>
												<div class="errocomfire" @click="closeerr">确定</div>
											</div>
										</div>
									</div>
								</div>
								
								
								<!-- 登录提示 -->
								<div class="judgepopup" v-show="tanchuang2 == 1">
									<div class="judgepopupnav">
										<div class="judgepopupwarp">
											<div class="judgepopupwarpup">
												<img src="./images/revoke_logo.png">
											</div>
											<div class="judgepopupwarpdown">
												<div class="judgepopupwarptxt">
													<p v-show="upStatus == 1 && languagestatus == 1">您还未登录,请先登录</p>
													<p v-show="upStatus == 1 && languagestatus == 2" >You have not logged in, please log in first</p>
													<div v-html="tipmes" v-show="upStatus == 2"></div>
												</div>
												<div class="judgepopupwarpbtn">
													<div v-show="upOther" class="judgepopupwarpbtnitem judgepopupwarpbtnactive" @click="closepopup">
														<p v-show="languagestatus == 1">确认</p>
														<p v-show="languagestatus == 2">determine</p>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
								<!--  -->
								<div class="judgepopup" v-show="tanchuang4 == 1">
									<div class="judgepopupnav">
										<div class="judgepopupwarp">
											<div class="judgepopupwarpup">
												<img src="./images/revoke_logo.png">
											</div>
											<div class="judgepopupwarpdown">
												<div class="judgepopupwarptxt">
													<div v-html="tipusermes"></div>
												</div>
												<div class="judgepopupwarpbtn">
													<div class="judgepopupwarpbtnitem judgepopupwarpbtnactive" @click="JumpPage">
														<p v-show="languagestatus == 2">确认</p>
														<p v-show="languagestatus == 2">determine</p>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
								<!-- 上传照片的提示 -->
								<div class="judgepopup" v-show="tanchuang5 == 1">
									<div class="judgepopupnav">
										<div class="judgepopupwarp">
											<div class="judgepopupwarpup">
												<img src="./images/revoke_logo.png">
											</div>
											<div class="judgepopupwarpdown">
												<div class="judgepopupwarptxt">
													<p>{{Upimgmsg}}</p>
												</div>
												<div class="judgepopupwarpbtn">
													<div class="judgepopupwarpbtnitem judgepopupwarpbtnactive" @click="JumpPage">
														<p v-show="languagestatus == 2">确认</p>
														<p v-show="languagestatus == 2">determine</p>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>

							</div>
						</div>
					</div>
					<div id="raceside" class="col-lg-4 col-md-4">
						<script src="js/racesidebar.js" type="text/javascript"></script>
					</div>
				</div>
			</div>
		</div>
		
		<script src="js/pcFooter.js" type="text/javascript"></script>
		<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
		<script src="https://unpkg.com/vue/dist/vue.js"></script>
		<script src="js/element.js"></script>
		<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
		<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.0/axios.min.js"></script>
		<script src="./layui/layui.js"></script>

		<script type="text/javascript">
			var index, layedit;
			
			let paychoice = new Vue({	
				el: '#paychoice',
				data: {
					upWorks: '',
					showWorks:'',
					choice: 0,
					moveshow:'',  //设备状态判断 0是pc，1是移动
					indexbannernum: 0,
					sideadnum: 0,
					tanchuang1: 0,
					tanchuang2: 0,
					tanchuang3: 0,
					tanchuang4:0,
					tanchuang5:0,
					agreementtip:0,
					upStatus: 0,
					upOther: false,
					choiceicon: 0,
					ischoice: true,
					changfabuPaychoice: 1,
					amount: '',
					coverimgs: [],
					imgData: {
						accept: 'image/gif, image/jpeg, image/png, image/jpg',
					},
					// bannerprice: 100,
					// sideprice: 100,
					totalmoney: '',
					racetypelist: [],
					typelist: [],
					token: '',
					userid: '',
					file: '',
					upimage: '',
					type: 0,
					fabutitle: '',
					fabukeyword: '',
					deadline: '',
					racedescription: '',
					money: '',
					reward: '',
					value2: '',
					datatime: '',
					adslist: [],
					count: "",
					indexk: 0,
					competitionid:0,
					wechatpayamount:'',
					wechatpayimg:'',
					wechatpayorder:'',
					wechatpaytype:'',
					wechatpaystastus:1,
					tipmes:'',
					tipusermes:'',
					tijiaotype:true,
					fabueditstatus:0,
					djs:'',
					fabueditid:'',
					ailurl:'',
					payurl:'',
					textedit:'',
					languagestatus:'',
					usercontent:'',
					userEcontent:'',
					fabuerr:0,
					Upimgmsg:''
				},
				// components:{
				// 	'el-date-picker':elDatePicker
				// },
				created:function() {
					if (sessionStorage.getItem('languagestatus')) {
						let languagestatus = sessionStorage.getItem('languagestatus')
						this.languagestatus = languagestatus
					}
				},
				mounted:function() {
					let that = this
					layui.use('layedit', function() {
						layedit = layui.layedit
						// layedit.build('textedit')
						layedit.set({
							height: 180,
							uploadImage: {
								url: 'http://127.0.0.1:8080/api/bishe.basics/contentupload',
								type: 'post'
							},
						})
						index = layedit.build('textedit')

					})
					if (localStorage.getItem('logininfo')) {
						let obj = JSON.parse(localStorage.getItem('logininfo'));
						that.userid = obj.userid
						that.token = obj.token
					}
					
					var theRequest = new Object()
					var url = location.search
					if (url.indexOf("?") != -1) {
						var str = url.substr(1); //substr()方法返回从参数值开始到结束的字符串；  
						var strs = str.split("&");
						for (var i = 0; i < strs.length; i++) {
							theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
						}
						if(theRequest.id&&theRequest.id !=''){
							that.competitionid = theRequest.id
						}
						that.fabueditid = theRequest.id
						if(theRequest.fabueditstatus == 1){
							that.fabueditstatus = 1;
						}
					}
					this.getdabuinfo()
					// that.gettextear()
					that.$refs.popupjiazai.style.display = 'block'
				},
				methods: {
					add0:function(m) {
						return m < 10 ? '0' + m : m
					},
					getLocalTime:function(nS) {
						let time = new Date(parseInt(nS) * 1000);
						var y = time.getFullYear();
						var m = time.getMonth() + 1;
						var d = time.getDate();
						var h = time.getHours();
						var mm = time.getMinutes();
						var s = time.getSeconds();
						return y + '/' + this.add0(m) + '/' + this.add0(d) + ' ' + this.add0(h) + ':' + this.add0(mm);
					},
					// 
					getdateRule:function(data) { // 中国标准时间，转换为日期格式Sat Dec 12 2020 15:40:54 GMT+0800 =》2020-12-12
						var now = data || ''
						now = new Date(now);
						console.log(now,"datae")
						if(now != ''){
							var year = now.getFullYear()
							var month = now.getMonth() + 1
							var day = now.getDate()
							var h = now.getHours();
							var mm = now.getMinutes();
							return year + '/' + this.add0(month) + '/' + this.add0(day) + ' ' + this.add0(h) + ':' + this.add0(mm);
						}
					},
					// 拉取信息
					getdabuinfo: function() {
						axios.get('http://127.0.0.1:8080/api/bishe.competition/competition', {

							})
							.then((res) => {
								let that = this
								that.adslist = res.data.data
								that.showWorks = res.data.data.image
								that.upWorks = res.data.data.fullimage
								let list = res.data.data.reward
								list.forEach((item, index) => {
									item.number = ''
								})
								that.racetypelist = res.data.data.reward;
								that.indexk = res.data.data.reward.length - 1;
								that.adslist.sidetime = that.getLocalTime(res.data.data.sidetime)
								that.adslist.hometime = that.getLocalTime(res.data.data.hometime)
								console.log(that.racetypelist)
								if(that.fabueditstatus == 1) {
									that.getreservationinfo();
								}
							})
					},
					// 用户协议信息
					getuersagreeinfo:function(){
						let that = this
						axios.get('http://127.0.0.1:8080/api/bishe.index/agreement',{
							params:{
								
							}
						})
						.then((res) =>{
							if(res.data.code == 1){
								that.usercontent = res.data.data.usercontent
								that.userEcontent = res.data.data.userEcontent
								console.log(111)
							}
						})
					},
					// 已保存信息
					getreservationinfo:function(){
						let that = this
						axios.get('http://127.0.0.1:8080/api/bishe.competition/competitionedit',{
							params:{
								userid:that.userid,
								token:that.token,
								competitionid:that.fabueditid
							}
						})
						.then((res) =>{
							if(res.data.code == 1){
								console.log(that.racetypelist)
								let obj = res.data.data
								let endtime = that.getLocalTime(res.data.data.endtime)
								that.fabutitle = obj.title
								
								let racetypelist = that.racetypelist
								console.log(that.racetypelist,'aksjdfhaksjdhflakjsdwuyqeui')
								racetypelist.forEach((item,index) =>{
									if(item.id == obj.sheji_reward_id){
										that.money = item.number = obj.money
									}
								})
								that.fabukeyword = obj.keyword
								that.showWorks = obj.image
								that.value2 = endtime
								layedit.setContent(index,obj.describecontent)
								// that.racetypelist.id = obj.sheji_reward_id
								that.indexbannernum = obj.home_ads
								that.sideadnum = obj.side_ads
								that.totalmoney = obj.pay_money
								that.reward = obj.sheji_reward_id
								console.log(res)
							}
						})
					},
					// 获取发布接口信息
					getaddinfo: function() {
						let that = this
						let formData = new FormData();
						formData.append('userid',that.userid);
						formData.append('token',that.token);
						formData.append('type',that.tijiaotype == true?0:1);
						formData.append('title',that.fabutitle);	
						formData.append('keyword',that.fabukeyword);
						formData.append('endtime',that.datatime);
						formData.append('money',that.money);
						formData.append('languagestatus',that.languagestatus);
						formData.append('rewardid',that.reward);
						formData.append('homeadsnum',that.indexbannernum);
						formData.append('sideadsnum',that.sideadnum);
						formData.append('describe',that.racedescription);
						formData.append('paymoney',that.totalmoney);
						formData.append('image',that.upimage !=''?that.upimage:that.upWorks);
						formData.append('competitionid',that.competitionid);
						axios({
								url:'http://127.0.0.1:8080/api/bishe.competition/add',
								method:'post',
								data:formData,
								headers:{
									'Content-Type':'application/x-www-form-urlencoded'
								}
							})
							.then((res) => {
								if (res.data.code == 1 && that.tijiaotype == true) {
									that.fabuerr = 0
									that.competitionid = res.data.data.competitionid
									that.getpayinfo()
								}else if(res.data.code == 1 && that.tijiaotype == false){
									that.fabuerr = 0
									that.upStatus = 2
									that.tipmes = res.data.msg
									that.tanchuang2 = 1
									setTimeout(function(){
										// that.tanchuang2 = 0
										window.location.href = 'personalcenter.html'
									},1300)
								}
								if(res.data.code == 0){
									that.choice = 0
									that.upStatus = 2
									that.upOther = true
									that.tipmes = res.data.msg
									that.tanchuang2 = 1
								}
								if(res.data.code == 2){
									that.tipusermes = res.data.msg
									that.tanchuang4 = 1
								}
							})
							.catch(err=>{
								console.log(err)
								that.fabuerr = 1
							})
					},
					// 请求失败关闭弹窗
					closeerr:function(){
						this.fabuerr = 0
					},
					// 请求支付接口
					getpayinfo:function(){
						let that = this
						axios.get('http://127.0.0.1:8080/api/bishe.pay/competitonpPay',{
							params:{
								type:that.changfabuPaychoice == 1? 'wechat':'alipay',
								id:that.competitionid,
								pay_method:that.changfabuPaychoice == 1?'scan':'web'
							}
						})
						.then((res) =>{
							if(res.data.code == 1){
								that.wechatpayamount = res.data.data.amount
								that.wechatpayimg = res.data.data.img
								that.wechatpayorder = res.data.data.order
								that.wechatpaytype = res.data.data.type
								if(that.changfabuPaychoice != 1){
									that.ailurl = res.data.data.url
									window.open(that.ailurl)
								}
								if(that.changfabuPaychoice == 1){
									let timer = setInterval(function(){
										if(that.wechatpaystastus == 1){
											that.gettestingstatus()
										}else{
											clearInterval(timer)
										}
									},2000)
								}
								if(that.changfabuPaychoice == 2){
									let timer = setInterval(function(){
										that.gettestingstatus()
									},2000)
								}
							}
						})
					},
					// 检测支付
					// gettestingstatus:function(){
					// 	let that = this
					// 	axios.post('http://127.0.0.1:8080/api/bishe.pay/check',{
					// 		type:that.changfabuPaychoice == 1? 0:1,
					// 		orderid:that.wechatpayorder,
					// 	})
					// 	.then((res) =>{
					// 		if(res.data.code == 1){
					// 			if(that.changfabuPaychoice == 1){
					// 				if(res.data.data.status == 'SUCCESS'){
					// 					that.wechatpaystastus = 0
					// 				}else{
					// 					that.wechatpaystastus = 1
					// 				}
					// 			}else{
					// 				if(res.data.data.status == 'TRADE_SUCCESS'){
					// 					let infonum = sessionStorage.getItem('infonum',infonum)
					// 					infonum = 5
					// 					sessionStorage.setItem('infonum',infonum)
					// 					window.location.href = 'personalcenter.html'
					// 				}
									
					// 			}
					// 		}
					// 	})
					// },
					// 打开支付弹窗
					openchoice: function() {
						let that = this
						if(that.token != ''){
							that.tijiaotype = true
							that.racedescription = layedit.getContent(index)
							let date = that.getdateRule(that.value2)
							that.datatime = new Date(date).getTime()
							if (that.choiceicon == 1 && that.totalmoney != '') {
								setTimeout(function(){
									if(that.tanchuang2 == 1){
										that.choice = 0
									}else{
										that.choice = 1
									}
								},800)
									
								if(that.changfabuPaychoice !=''){
									that.getaddinfo()
								}
							} else {
								that.tanchuang1 = 1
							}
						}else{
							that.upStatus = 1
							that.upOther = true
							that.tanchuang2 = 1
						}
					},
					// 微信 支付宝
					// changPaychoice(num){
					// 	let that = this
					// 	that.changfabuPaychoice = num
					// 	that.getpayinfo()
					// },
					// 无效用户跳转
					JumpPage:function(){
						window.location.href = 'login.html'
					},
					// checkbox
					agreeicon: function() {
						let that = this
						if (that.ischoice) {
							that.choiceicon = 1
						} else {
							that.choiceicon = 0
						}
						that.ischoice = !that.ischoice
					},
					// 关闭勾选弹窗
					closeagreement: function() {
						this.tanchuang1 = 0
					},
					// 首页banner数量-
					reduceindex: function() {
						let that = this
						if (that.indexbannernum == 0) {
							that.indexbannernum = 0
						} else {
							that.indexbannernum = that.indexbannernum - 1
						}
						this.totalmoney = Number(this.adslist.homemoney * this.indexbannernum) + Number(this.adslist.sidemoney * this.sideadnum) +
							Number(that.money)
					},
					// 首页banner数量+
					plusindex: function() {
						let that = this
						that.indexbannernum = that.indexbannernum + 1
						this.totalmoney = Number(this.adslist.homemoney * this.indexbannernum) + Number(this.adslist.sidemoney * this.sideadnum) +
							Number(that.money)
					},
					// 侧边栏banner数量-
					reduceside: function() {
						let that = this
						if (that.sideadnum == 0) {
							that.sideadnum = 0
						} else {
							that.sideadnum = that.sideadnum - 1
						}
						this.totalmoney = Number(this.adslist.homemoney * this.indexbannernum) + Number(this.adslist.sidemoney * this.sideadnum) +
							Number(that.money)
					},
					// 侧边栏banner数量+
					plusside: function() {
						let that = this
						that.sideadnum = that.sideadnum + 1
						this.totalmoney = Number(this.adslist.homemoney * this.indexbannernum) + Number(this.adslist.sidemoney * this.sideadnum) +
							Number(that.money)
					},
					// 删除订单
					getdingdannum:function(){
						let that = this
						axios.get('http://127.0.0.1:8080/api/bishe.competition/unpay',{
							params:{
								competitionid:that.competitionid
							}
						})
						.then((res)=>{
							
						})
					},
					
					fabuconsolePay: function() {
						this.choice = 0
						this.xschoice = 0
						this.choiceicon = 0
						this.getdingdannum()
					},
					// 上传照片
					add_img: function(e) {
						var that = this;
						var file = e.target.files[0];
						var formData = new FormData();
						that.file = file;
						formData.append("file", file);

						if (file) {
							this.file = file;
							var reader = new FileReader();
							reader.readAsDataURL(file);
							reader.onload = function() {
								that.showWorks = this.result;
								that.fileStatus = false;
							};
						}
						axios.post('http://127.0.0.1:8080/api/bishe.basics/upload', formData)
							.then((res) => {
								if(res.data.code == 1){
									that.upimage = res.data.data.url
								}
								if(res.data.code == 2){
									that.Upimgmsg = res.data.msg
								}
							})
					},
					// 支付成功  确定按钮
					comfirefabu:function(){
						if(this.choice == 1){
							window.location.href = 'personalcenter.html'
							let infonum = sessionStorage.getItem('infonum')
							infonum = 5
							sessionStorage.setItem('infonum',infonum)
						}
					},
					// 打开保存弹窗
					// preservation: function() {
					// 	let that = this
					// 	if(that.token != ''){
					// 		that.tijiaotype = false
					// 		that.racedescription = layedit.getContent(index)
					// 		let time = new Date().getTime(that.value2)
					// 		that.datatime = time
					// 		that.upStatus = 2
					// 		that.upOther = true
					// 		that.tanchuang2 = 1
					// 		that.getaddinfo()
					// 	}else if(that.token == ''){
					// 		that.upStatus = 1
					// 		that.upOther = true
					// 		that.tanchuang2 = 1
					// 	}
						
					// },
					// 确定保存
					// preservationinfo: function() {
					// },
					// 取消保存
					// closepreservation: function() {
					// 	this.tanchuang3 = 0
					// },
					// 关闭提示弹窗
					closepopup: function() {
						let that = this
						that.tanchuang2 = 0
						// if(that.upStatus == 1){  //未登录
							// let num = sessionStorage.getItem('loginpage')
							// sessionStorage.setItem('loginpage',1)
							// location.reload()
						// }else{  //已登录提示消息
						// 	that.tanchuang2 = 0
						// }
					},
					// 
					changemoned(i) {
						let that = this
						let list = that.racetypelist
						list.forEach((item, index) => {
							if (i != index) {
								item.number = ''
							} else {}
						})
						that.racetypelist = list;
						that.$forceUpdate()
					},
					// 
					blurClick(i, id) {
						let that = this,
						racetypelist = this.racetypelist;
						racetypelist.forEach((item, index) => {
							if (i == index) {
								if (!item.maxmoney) {
									if (item.number < item.minmoney) {
										item.number = item.minmoney
										that.money = item.number
										that.reward = item.id
									}
								} else {
									if (item.number < item.minmoney) {
										item.number = item.minmoney
										that.money = item.number
										that.reward = item.id
									} else if(item.number > item.maxmoney){
										item.number = item.maxmoney
										that.money = item.number
										that.reward = item.id
									}else if(item.minmoney < item.number < item.maxmoney){
										item.number = item.number
										that.money = item.number
										that.reward = item.id
										console.log(item.number)
									}
								}
								that.totalmoney = Number(that.adslist.homemoney * that.indexbannernum) + Number(that.adslist.sidemoney *
										that.sideadnum) +
									Number(that.money)
							}
							
						})
						
						that.racetypelist = racetypelist;
						that.$forceUpdate()
					},
					// 打开用户协议
					// openuseragreement:function(){
					// 	this.agreementtip = 1
					// 	this.getuersagreeinfo()
					// },
					closeagreementtip:function(){
						this.agreementtip = 0
					}
				}
			})

		</script>
	</body>
</html>
